﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Configuration;
using BusinessRule.Common;

namespace TransferInSiteData
{
    public partial class TransferInSiteData : ServiceBase
    {
        public TransferInSiteData()
        {
            InitializeComponent();
        }
        TransferInsiteDataBusiness.TransferInsiteDataBusiness runMain = new TransferInsiteDataBusiness.TransferInsiteDataBusiness();
        private System.Timers.Timer m_SyncTimer;//服务启动
        private System.Timers.Timer m_SpecSyncTimer;//工序更新
        private System.Timers.Timer m_StatusSyncTimer;//状态更新
        private System.Timers.Timer m_TeamDispatchSyncTimer;//班组派工
        private System.Timers.Timer m_ContainerShipSyncTimer;//批次转工
        private System.Timers.Timer m_UpdateMaterialSyncTimer;//更新领料时间
        private System.Timers.Timer m_UpdateContainerQtySyncTimer;//更新批次数量()
        private System.Timers.Timer m_UpdateWorkCenterDispachSyncTimer;//更新工区协作信息
        private System.Timers.Timer m_AddTimeSheetInfoSyncTimer;//添加工时信息
        private System.Timers.Timer m_UpdateContainerOfNoBatchSyncTimer;//更新无机型的批次
        private System.Timers.Timer m_DelLoseStepTimeInfoSyncTimer;//删除没有检验记录的工时记录
        private System.Timers.Timer m_UpdateDifferDesSyncTimer;//更新产品或工序分厂不同的批次
        private System.Timers.Timer m_SupplyAutoShipSyncTimer;//补充自动转工记录
        private System.Timers.Timer m_UpdateChangContainerIDtoNameInfoSyncTimer;//变号记录ID变更
        private System.Timers.Timer m_SupplySubworkflowSyncTimer;//Subworkflowcheckinfo补充
        private System.Timers.Timer m_SupplyMoveSyncTimer;//补充移动
        private System.Timers.Timer m_ContainerNoSyncTimer;//更新批次号
        private System.Timers.Timer m_SendMaterialSyncTimer;//更新发料信息
        private System.Timers.Timer m_GZAutoStartSyncTimer;//工装工具自动开卡 add by zhangrj 20250109
        private System.Timers.Timer m_RBDeleContainerSyncTimer;//热表批次删除 add by zhangrj 20250609
        private System.Timers.Timer m_ContainerSplitSyncTimer;//批次分卡服务（批次分卡相关处理都可以用这个线程）add by zhangrj 20250903
        protected override void OnStart(string[] args)
        {
            LogHelp.SetConfig();
            LogHelp.WriteLog("服务启动");
            int intSync = Convert.ToInt32(ConfigurationManager.AppSettings["sync"].ToString());

            //服务启动
            Action<object, System.Timers.ElapsedEventArgs> m_SyncTimer_E = m_SyncTimer_Elapsed;
            SyncTimerStatr(ref m_SyncTimer, m_SyncTimer_E, intSync);
            //工序更新
            Action<object, System.Timers.ElapsedEventArgs> m_SpecSyncTimer_E = m_SpecSyncTimer_Elapsed;
            SyncTimerStatr(ref m_SpecSyncTimer, m_SpecSyncTimer_E, intSync);
            //状态更新
            //Action<object, System.Timers.ElapsedEventArgs> m_StatusSyncTimer_E = m_StatusSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_StatusSyncTimer, m_StatusSyncTimer_E, intSync);
            //班组派工
            //Action<object, System.Timers.ElapsedEventArgs> m_TeamDispatchSyncTimer_E = m_TeamDispatchSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_TeamDispatchSyncTimer, m_TeamDispatchSyncTimer_E, intSync);
            //批次转工
            //Action<object, System.Timers.ElapsedEventArgs> m_ContainerShipSyncTimer_E = m_ContainerShipSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_ContainerShipSyncTimer, m_ContainerShipSyncTimer_E, intSync);
            //更新领料时间
            //Action<object, System.Timers.ElapsedEventArgs> m_UpdateMaterialSyncTimer_E = m_UpdateMaterialSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_UpdateMaterialSyncTimer, m_UpdateMaterialSyncTimer_E, intSync);
            //更新批次数量
            //Action<object, System.Timers.ElapsedEventArgs> m_UpdateContainerQtySyncTimer_E = m_UpdateContainerQtySyncTimer_Elapsed;
            //SyncTimerStatr(ref m_UpdateContainerQtySyncTimer, m_UpdateContainerQtySyncTimer_E, intSync);
            //更新工区协作信息
            //Action<object, System.Timers.ElapsedEventArgs> m_UpdateWorkCenterDispachSyncTimer_E = m_UpdateWorkCenterDispachSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_UpdateWorkCenterDispachSyncTimer, m_UpdateWorkCenterDispachSyncTimer_E, intSync);
            //添加工时信息
            Action<object, System.Timers.ElapsedEventArgs> m_AddTimeSheetInfoSyncTimer_E = m_AddTimeSheetInfoSyncTimer_Elapsed;
            SyncTimerStatr(ref m_AddTimeSheetInfoSyncTimer, m_AddTimeSheetInfoSyncTimer_E, intSync * 60);
            //更新无机型的批次
            Action<object, System.Timers.ElapsedEventArgs> m_UpdateContainerOfNoBatchSyncTimer_E = m_UpdateContainerOfNoBatchSyncTimer_Elapsed;
            SyncTimerStatr(ref m_UpdateContainerOfNoBatchSyncTimer, m_UpdateContainerOfNoBatchSyncTimer_E, intSync * 120 * 3);
            //删除没有检验记录的工时记录,20221114暂停此逻辑，检验撤销添加工时撤销逻辑
            //Action<object, System.Timers.ElapsedEventArgs> m_DelLoseStepTimeInfoSyncTimer_E = m_DelLoseStepTimeInfoSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_DelLoseStepTimeInfoSyncTimer, m_DelLoseStepTimeInfoSyncTimer_E, intSync * 60);
            //更新产品或工序分厂不同的批次
            Action<object, System.Timers.ElapsedEventArgs> m_UpdateDifferDesSyncTimer_E = m_UpdateDifferDesSyncTimer_Elapsed;
            SyncTimerStatr(ref m_UpdateDifferDesSyncTimer, m_UpdateDifferDesSyncTimer_E, intSync * 2 * 10);
            //补充自动转工记录
            //Action<object, System.Timers.ElapsedEventArgs> m_SupplyAutoShipSyncTimer_E = m_SupplyAutoShipSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_SupplyAutoShipSyncTimer, m_SupplyAutoShipSyncTimer_E, intSync);
            //变号记录ID变更
            Action<object, System.Timers.ElapsedEventArgs> m_UpdateChangContainerIDtoNameInfoSyncTimer_E = m_UpdateChangContainerIDtoNameInfoSyncTimer_Elapsed;
            SyncTimerStatr(ref m_UpdateChangContainerIDtoNameInfoSyncTimer, m_UpdateChangContainerIDtoNameInfoSyncTimer_E, intSync * 60);
            //补充移动(自动移动)
            Action<object, System.Timers.ElapsedEventArgs> m_SupplyMoveSyncTimer_E = m_SupplyMoveSyncTimer_Elapsed;
            SyncTimerStatr(ref m_SupplyMoveSyncTimer, m_SupplyMoveSyncTimer_E, intSync * 120);
            //更新批次号
            //Action<object, System.Timers.ElapsedEventArgs> m_ContainerNoSyncTimer_E = m_ContainerNoSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_ContainerNoSyncTimer, m_ContainerNoSyncTimer_E, intSync);
            //更新发料信息
            //Action<object, System.Timers.ElapsedEventArgs> m_SendMaterialSyncTimer_E = m_SendMaterialSyncTimer_Elapsed;
            //SyncTimerStatr(ref m_SendMaterialSyncTimer, m_SendMaterialSyncTimer_E, intSync);
            //工装工具自动开卡
            Action<object, System.Timers.ElapsedEventArgs> m_GZAutoStartSyncTimer_E = m_GZAutoStartSyncTimer_Elapsed;
            SyncTimerStatr(ref m_GZAutoStartSyncTimer, m_GZAutoStartSyncTimer_E, intSync * 120);
            //热表批次删除
            Action<object, System.Timers.ElapsedEventArgs> m_RBDeleContainerSyncTimer_E = m_RBDeleContainerSyncTimer_Elapsed;
            SyncTimerStatr(ref m_RBDeleContainerSyncTimer, m_RBDeleContainerSyncTimer_E, intSync * 120);
            //批次分卡服务
            Action<object, System.Timers.ElapsedEventArgs> m_ContainerSplitSyncTimer_E = m_ContainerSplitSyncTimer_Elapsed;
            SyncTimerStatr(ref m_ContainerSplitSyncTimer, m_ContainerSplitSyncTimer_E, intSync * 120);
        }

        /// <summary>
        /// 传参启动新线程并运行方法
        /// </summary>
        /// <param name="timer"></param>
        /// <param name="m_timerElapsed"></param>
        private void SyncTimerStatr(ref System.Timers.Timer timer, Action<object, System.Timers.ElapsedEventArgs> m_timerElapsed, int intSync)
        {
            timer = new System.Timers.Timer();
            timer.Enabled = false;
            timer.Elapsed += new System.Timers.ElapsedEventHandler(m_timerElapsed);

            timer.Interval = intSync * 1000;
            timer.Enabled = true;
            timer.Start();
        }

        /// <summary>
        ///  启动服务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_SyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_SyncTimer.Enabled = false;
                runMain.RunDataSync();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("TransferMESData定时器异常", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_添加批次" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   
            }
            finally
            {
                GC.Collect();
                m_SyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  工序更新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_SpecSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_SpecSyncTimer.Enabled = false;
                runMain.UpdateSpecInfo();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("TransferMESData定时器异常", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_工序更新" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   
            }
            finally
            {
                GC.Collect();
                m_SpecSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  状态更新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_StatusSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_StatusSyncTimer.Enabled = false;
                runMain.RevertContainer();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("TransferMESData定时器启动失败", myError);
            }
            finally
            {
                GC.Collect();
                m_StatusSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  班组派工
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_TeamDispatchSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_TeamDispatchSyncTimer.Enabled = false;
                runMain.UpdateTeamDispach();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新班组派工", myError);
            }
            finally
            {
                GC.Collect();
                m_TeamDispatchSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  转工处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_ContainerShipSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_ContainerShipSyncTimer.Enabled = false;
                runMain.UpdateContainerShip();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新批次转工信息", myError);
            }
            finally
            {
                GC.Collect();
                m_ContainerShipSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  更新领料时间
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_UpdateMaterialSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_UpdateMaterialSyncTimer.Enabled = false;
                runMain.UpdateMaterial();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新领料时间", myError);
            }
            finally
            {
                GC.Collect();
                m_UpdateMaterialSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  更新批次数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_UpdateContainerQtySyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_UpdateContainerQtySyncTimer.Enabled = false;
                runMain.UpdateContainerQtyInfo();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新批次数量", myError);
            }
            finally
            {
                GC.Collect();
                m_UpdateContainerQtySyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  更新批次数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_UpdateWorkCenterDispachSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_UpdateWorkCenterDispachSyncTimer.Enabled = false;
                runMain.UpdateWorkCenterDispach();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新工区协作", myError);
            }
            finally
            {
                GC.Collect();
                m_UpdateWorkCenterDispachSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  添加工时信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_AddTimeSheetInfoSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_AddTimeSheetInfoSyncTimer.Enabled = false;
                runMain.GetFinishCheckWorkReportToTimeSheet();//添加成检报工记录到工时
                runMain.GetStepCheckWorkReportToTimeSheet();//添加工序检报工记录到工时
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("添加工时信息", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_添加工时" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   

            }
            finally
            {
                GC.Collect();
                m_AddTimeSheetInfoSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  更新无机型的批次
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_UpdateContainerOfNoBatchSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_UpdateContainerOfNoBatchSyncTimer.Enabled = false;
                runMain.UpdateContainerOfNoBatch();//更新无机型的批次
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新无机型的批次", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_更新无机型的批次" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   
            }
            finally
            {
                GC.Collect();
                m_UpdateContainerOfNoBatchSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  删除没有检验记录的工时记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_DelLoseStepTimeInfoSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_DelLoseStepTimeInfoSyncTimer.Enabled = false;
                runMain.DelLoseStepTimeInfo();//删除没有检验记录的工时记录
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("删除没有检验记录的工时记录", myError);
            }
            finally
            {
                GC.Collect();
                m_DelLoseStepTimeInfoSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  更新产品或工序分厂不同的批次
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_UpdateDifferDesSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_UpdateDifferDesSyncTimer.Enabled = false;
                runMain.UpdateDifferDes();//更新产品或工序分厂不同的批次
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新产品或工序分厂不同的批次", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_更新产品或工序分厂" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   

            }
            finally
            {
                GC.Collect();
                m_UpdateDifferDesSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  补充自动转工记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_SupplyAutoShipSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_SupplyAutoShipSyncTimer.Enabled = false;
                //runMain.SupplyAutoShip();//补充自动转工记录
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("补充自动转工记录", myError);
            }
            finally
            {
                GC.Collect();
                m_SupplyAutoShipSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  变号记录ID变更
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_UpdateChangContainerIDtoNameInfoSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_UpdateChangContainerIDtoNameInfoSyncTimer.Enabled = false;
                runMain.UpdateChangContainerIDtoNameInfo();//变号记录ID变更
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("变号记录ID变更", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_变号记录ID变更" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   
            }
            finally
            {
                GC.Collect();
                m_UpdateChangContainerIDtoNameInfoSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  补充移动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_SupplyMoveSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_SupplyMoveSyncTimer.Enabled = false;
                runMain.SupplyMove();//补充移动
                runMain.UpdateFaContainerMoveByRB();//补充热表主卡移动和报工数据
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("补充移动", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_补充移动" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   
            }
            finally
            {
                GC.Collect();
                m_SupplyMoveSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  更新批次号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_ContainerNoSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                runMain.UpdateContainerNo();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新批次", myError);
            }
            finally
            {
                GC.Collect();
                m_ContainerNoSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  更新领料信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_SendMaterialSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                runMain.UpdateSendMaterial();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("更新领料信息", myError);
            }
            finally
            {
                GC.Collect();
                m_SendMaterialSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  工装工具自动开卡 add by zhangrj 20250109
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_GZAutoStartSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_GZAutoStartSyncTimer.Enabled = false;
                runMain.CreateGZContainerInfo();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("TransferMESData定时器异常", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_工装工具自动开卡" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   
            }
            finally
            {
                GC.Collect();
                m_GZAutoStartSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  热表删除转工子卡批次 add by zhangrj 20250609
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_RBDeleContainerSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                DateTime nowDate = DateTime.Now;
                DateTime deleStartDate = DateTime.Parse(string.Format("{0} 00:00:00", nowDate.ToShortDateString()));
                DateTime deleEndDate = DateTime.Parse(string.Format("{0} 05:00:00", nowDate.ToShortDateString()));
                if (nowDate >= deleStartDate && nowDate <= deleEndDate)
                {
                    m_RBDeleContainerSyncTimer.Enabled = false;
                    runMain.DeleRBContainerForShipOverTime();
                }
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("TransferMESData定时器异常", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_热表删除转工子卡" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   
            }
            finally
            {
                GC.Collect();
                m_RBDeleContainerSyncTimer.Enabled = true;
            }
        }

        /// <summary>
        ///  批次分卡服务 add by zhangrj 20250903
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_ContainerSplitSyncTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                m_ContainerSplitSyncTimer.Enabled = false;
                runMain.SaveWfChangeSplitHoldInfo();
            }
            catch (Exception myError)
            {
                LogHelp.WriteError("TransferMESData定时器异常", myError);
                LogHelp.WriteOrcaleError("TransferInsiteData_批次分卡" + "@^" + myError.Message + myError.StackTrace + "@^" + "" + "@^" + Convert.ToString(Guid.NewGuid()) + "@^" + "");//add:Wangjh 写入数据库   
            }
            finally
            {
                GC.Collect();
                m_ContainerSplitSyncTimer.Enabled = true;
            }
        }

        protected override void OnStop()
        {
            LogHelp.WriteLog("服务停止");
        }
    }
}
